package com.weipai.springboot.module.mapper;

import com.weipai.springboot.model.CustomerAddress;
import com.weipai.springboot.model.CustomerInvoice;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.util.List;
import java.util.Map;

public interface CustomerInvoiceMapper {
    int deleteByPrimaryKey(String invoiceId);

    int insert(CustomerInvoice record);

    int insertSelective(CustomerInvoice record);

    CustomerInvoice selectByPrimaryKey(String invoiceId);

    int updateByPrimaryKeySelective(CustomerInvoice record);

    int updateByPrimaryKey(CustomerInvoice record);

    //获取用户的发票
    List<CustomerInvoice> invoiceList(String customerId);

    //修改发票
    @Update("update c_customer_invoice set company_name=#{companyName}, tax_number=#{taxNumber}, is_default=#{isDeFault}, " +
            "update_time=date_format(now(), '%Y-%m-%d %H:%i:%s') " +
            "where invoice_id=#{id}")
    int updateInvoice(@Param("id") String invoiceId, @Param("companyName") String companyName,
                      @Param("taxNumber") String taxNumber, @Param("isDeFault") Integer isDeFault);


    //验证是否有默认发票
    CustomerInvoice varCustomerInvoice(String customerId);



}